from mimetypes import guess_type
from random import randint
# for i in range(1,10+1,2):  # 0-9
#     print(i, end="\t")


#打印100以内   能被3整除的数字
# for i in range(1,100+1):
#     if i % 3 ==0:
#         print(i,end="\t")

# 猜数字
# 产生随机数
# num = randint(1,20)
# while True:
#     guess = int(input("请输入一个数字："))
#     if guess > num:
#         print("太大了")
#     elif guess < num:
#         print("太小了")
#     else:
#         print("猜对了")
#         break

# for i in range(1, 100 + 1):
#     # if 1 % 7 == 0 or str(i).find('7') != -1:
#     # if i % 7 ==0 or str(i).count('7')>0:
#     if i % 7 == 0 or '7' in str(i) != -1:
#         print(i, end="\t")

# 打印菱形
# for i in range(1,11+1,2):
#     print(("*" * i).center(11))
# for i in range(9,0,-2):
#     print(("*" * i).center(11))


#打印菱形2 多层循环嵌套

#打印水仙花数
for num in range(100, 1000):
    # 分解出百位、十位和个位
    hundreds = num // 100
    tens = (num // 10) % 10
    ones = num % 10
    # 计算每位数字的三次方之和
    if num == hundreds ** 3 + tens ** 3 + ones ** 3:
        print(num)
#打印100 以内的质数
# 打印100以内的质数

def is_prime(n):
    """判断一个数是否为质数"""
    if n <= 1:
        return False
    if n <= 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i += 6
    return True

# 遍历1到100之间的所有数字
for num in range(1, 101):
    if is_prime(num):
        print(num)


#打印斐波那契数列

#打印九九乘法表
for i in range(1, 10):
    for j in range(1, i + 1):
        print(f"{j}*{i}={i * j}", end="\t")
    print()
#打印100 以内的完数